﻿/*****************************************************************************
 
 Use of Ext is under the Ext JS license, for more information, 
 please visit http://extjs.com/products/license.php page. 
  
 You should confirm that you have read, understood and accept ethical criteria listed. 
 If not, see <http://www.mvcnext.com/license/>.
  
 Version: 1.0.0.0
 Website: http://www.mvcnext.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/
using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.IO;
using System.Reflection;
using System.Collections;
using System.Web.UI;
using System.Text;

[assembly: WebResource("MVCnExt.Web.UI.Ext.Scripts.resources.css.panel.css", "text/css", PerformSubstitution=true)]
namespace MVCnExt.Web.UI.Ext
{
    /// <summary>
    /// Panel is a contentContainer that has specific functionality and structural components that make it the perfect building block for application-oriented user interfaces.
    /// </summary>
    [Description("Panel is a contentContainer that has specific functionality and structural components that make it the perfect building block for application-oriented user interfaces.")]
    public class ExtItem : ExtConfigBoxComponent
    {
        private String _shadow = null;
        private Object _activeItem;
        private List<ConfigItem> _defaults = new List<ConfigItem>();        
        private List<ExtItem> _buttons = new List<ExtItem>();
        private List<ExtItem> _items = new List<ExtItem>();
        private List<ExtItem> _keys = new List<ExtItem>();
        private List<ScriptReference> _references = new List<ScriptReference>();
        private List<ConfigItem> _tbar = new List<ConfigItem>();

        public override List<ScriptReference> GetScriptReferences()
        {
            return base.GetScriptReferences();
        }

        public override IList<ScriptDescriptor> GetScriptDescriptors()
        {
            IList<ScriptDescriptor> list = base.GetScriptDescriptors();

            ScriptControlDescriptorBase desc = (ScriptControlDescriptorBase)list[0];

            desc.Type = "Ext.xtype";

            String[] properties = new String[]{
                "id", "animCollapse", "autoLoad", "autoScroll", "baseCls", "bbar", "bodyBorder",
                "border", "bufferResizeMilliseconds", "buttonAlign", "collapseFirst", 
                "collapsed", "collapsedCls", "collapsible", "draggable", "elements",
                "floating", "footer", "frame", "header", "headerAsText", "hideCollapseTool", 
                "iconCls", "maskDisabled", "minButtonWidth", "shadow", "shadowOffset",
                "shim", "tabTip", "title", "titleCollapse", "tools", "region", "name", "split",
                "bodyStyle", "text", "activeItem", "autoDestroy", "bufferResize", "defaultType",
                "hideBorders", "layout", "layoutConfig", "monitorResize", "resizeTabs", "minTabWidth", 
                "tabWidth", "enableTabScroll", "activeTab", "deferredRender","modal", "title", "autoHeight", 
                "autoWidth", "pageX", "pageY", "x", "y", "minSize", "maxSize", "layout",   
                "caseSensitive", "dir", "folderSort", "leafAttr", "property", "sortType",
                "animate", "containerScroll", "ddAppendOnly", "ddGroup", "ddScroll", "enableDD", "enableDrag", "enableDrop",
                "highlightColor", "highlightDrop", "lines", "pathSeparator", "rootVisible", "singleExpand", 
                "leaf", "allowChildren", "allowDrop", "cls", "disabled", "expanded",
                "href", "hrefTarget", "iconFile", "icon", "isTarget", "qtip", "singleClickExpand",
                "Checked", "allowOtherMenus", "defaultAlign", "minWidth", 
                "shadow", "subMenuAlign", "activeClass", "canActivate",  
                "hideDelay", "hideOnClick", "scope", "showDelay",
                "autoCreate", "clearCls", "fieldClass", "fieldLabel", "focusClass", "hideLabel", "invalidClass", "invalidText",  
                "labelSeparator", "labelStyle", "msgFx", "readOnly", "tabIndex", "validateOnBlur", "validateDelay", "validationEvent", "value",
                 "allowBlank", "blankText", "disableKeyFilter", "emptyClass", "emptyText", "grow",  "growMax", "growMin",
                "maskRe", "maxLength", "maxLengthText", "regex", "regexText", "selectOnFocus", "truncate",  
                "vtype", "vtypeText", "groupName", "allowDecimals", "allowNegative", "baseChars", "decimalPrecision", "decimalSeparator", 
                "maxText",  "maxValue", "growMin", "minText", "minValue", "nanText",  "createLinkText", "defaultLinkValue", "enableAlignments", "enableColors", "enableFont",
                "enableFontSize", "enableFormat", "enableLinks", "enableLists", "enableSourceEdit", "fontFamilies",
                "checkboxName", "checkboxToggle", "style",
                 "cancelText", "constrainToViewport", "dayNames", "disabledDatesRE", "disabledDatesText",
                "disabledDays", "disabledDaysText", "format", "maxDate", "maxText", "minDate", "minText",
                "monthNames", "monthYearText", "nextText", "okText", "prevText", "startDay", "todayText",
                "todayTip",
                 "allQuery", "displayField", "editable", "forceSelection", "handleHeight", "hiddenName", "lazyRender", "listAlign",
                "listClass", "listWidth", "loadingText", "maxHeight", "minHeight", "minChars", "minListWidth", "minListWidth",
                "pageSize", "queryDelay", "queryParam", "resizable", "selectedClass", "enableShadow", 
                "transform", "typeAhead", "typeAheadDelay", "valueField", "valueNotFoundText", "triggerAction", "mode",
                "allowReselect", "tpl", "colors",
                "checkedCls", "focusCls", "inputValue", "mouseDownCls", "overCls",
                 "allowDepress", "clickEvent", "enableToggle", "handleMouseEvents",
                "hidden", "menuAlign", 
                "pressed", "repeat", "template", "toggleGroup",
                "toggleHandler", "tooltip", "tooltipType", "type", "closable", "constrain", "anchor"
            };

            Type component = typeof(ExtItem);

            foreach (String property in properties)
            {
                PropertyInfo i = component.GetProperty(property);

                if (i == null)
                    throw new InvalidOperationException(String.Format("Property not found, 'ExtItem.{0}'", property));

                Object value = i.GetValue(this, null);

                ////get the default value
                //if (value == null)
                //{
                //    // Gets the attributes for the property.
                //    System.ComponentModel.AttributeCollection attributes =
                //       TypeDescriptor.GetProperties(this)[property].Attributes;

                //    /* get the default value by retrieving the DefaultValueAttribute 
                //       from the AttributeCollection. */
                //    DefaultValueAttribute defaultAttribute =
                //       (DefaultValueAttribute)attributes[typeof(DefaultValueAttribute)];
                //    if (defaultAttribute != null)
                //        value = defaultAttribute.Value;
                //}
                
                if (value == null)
                {
                    continue;
                }

                if (!(value is String) && !(value is region) && !(value is xtype))
                    desc.AddPropertyBase(property, value);
                else
                    desc.AddPropertyBase(property, String.Format("'{0}'", value));
            }

            //add items
            if (buttons != null && buttons.Count != 0)
            {
                // build items list
                StringBuilder itemList = new StringBuilder("[");

                for (int i = 0; i < buttons.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        itemList.Append(",");
#if DEBUG
                        itemList.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = buttons[i].GetScriptDescriptors();

                    // get the items's list of script dependencies
                    List<ScriptReference> references = buttons[i].GetScriptReferences();

                    // make sure the script dependencies are registered
                    _references.AddRange(references);

                    // write the item's config to the list
                    itemList.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                itemList.Append("]");

                desc.AddPropertyBase("buttons", itemList);
            }


            //menu
            if (menu != null)
            {
                // items script
                ScriptControlDescriptorBase descriptor = (ScriptControlDescriptorBase)menu.GetScriptDescriptors()[0];

                // get the items's list of script dependencies
                _references.AddRange(menu.GetScriptReferences());

                // write config script to properties
                desc.AddPropertyBase("menu", descriptor.WriteScript(ScriptType.NewOnly));
            }

            //add nodes
            if (children != null && children.Count != 0)
            {
                // build child tree
                StringBuilder tabList = new StringBuilder("[");

                for (int i = 0; i < children.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        tabList.Append(",");
#if DEBUG
                        tabList.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = children[i].GetScriptDescriptors();

                    // write the item's config to the list
                    tabList.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                tabList.Append("]");

                desc.AddPropertyBase("children", tabList);
            }


            //add nodes
            if (root != null)
            {
                // build tree
                StringBuilder rootNode = new StringBuilder("");

                for (int i = 0; i < root.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        rootNode.Append(",");
#if DEBUG
                        rootNode.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = root[i].GetScriptDescriptors();

                    // get the items's list of script dependencies
                    List<ScriptReference> references = root[i].GetScriptReferences();

                    // make sue the scrript dependencies are registered
                    _references.AddRange(references);

                    // write the item's config to the list
                    rootNode.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                rootNode.Append("");

                desc.AddPropertyBase("root", rootNode);
            }

            //add nodes
            if (loader != null)
            {
                // build tree
                StringBuilder treeLoader = new StringBuilder("");

                for (int i = 0; i < loader.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        treeLoader.Append(",");
#if DEBUG
                        treeLoader.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = loader[i].GetScriptDescriptors();

                    // get the items's list of script dependencies
                    List<ScriptReference> references = loader[i].GetScriptReferences();

                    // make sue the scrript dependencies are registered
                    _references.AddRange(references);

                    // write the item's config to the list
                    treeLoader.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                treeLoader.Append("");

                desc.AddPropertyBase("loader", treeLoader);
            }


            //add tbar
            if (tbar != null && tbar.Count != 0)
            {
                StringBuilder config = new StringBuilder("{");

                for (int i = 0; i < tbar.Count; i++)
                {
                    if (i != 0)
                    {
                        config.Append(",");
#if DEBUG
                        config.AppendLine();
#endif
                    }
                    config.AppendFormat("{0} : '{1}'", tbar[i].name, tbar[i].value);
                }

                config.Append("}");

#if DEBUG
                config.AppendLine();
#endif

                desc.AddPropertyBase("tbar", config);
            }

            //add defaults
            if (defaults != null && defaults.Count != 0)
            {
                StringBuilder config = new StringBuilder("{");

                for (int i = 0; i < defaults.Count; i++)
                {
                    if (i != 0)
                    {
                        config.Append(",");
#if DEBUG
                        config.AppendLine();
#endif
                    }
                    config.AppendFormat("{0} : '{1}'", defaults[i].name, defaults[i].value);
                }

                config.Append("}");

#if DEBUG
                config.AppendLine();
#endif

                desc.AddPropertyBase("defaults", config);
            }

            //add items
            if (items != null && items.Count != 0)
            {
                // build items list
                StringBuilder itemList = new StringBuilder("[");

                for (int i = 0; i < items.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        itemList.Append(",");
#if DEBUG
                        itemList.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = items[i].GetScriptDescriptors();

                    // get the items's list of script dependencies
                    List<ScriptReference> references = items[i].GetScriptReferences();

                    // make sure the script dependencies are registered
                    _references.AddRange(references);

                    // write the item's config to the list
                    itemList.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                itemList.Append("]");

                desc.AddPropertyBase("items", itemList);
            }

            //add items
            if (keys != null && keys.Count != 0)
            {
                // build items list
                StringBuilder itemList = new StringBuilder("[");

                for (int i = 0; i < keys.Count; i++)
                {
                    // add comma between items
                    if (i != 0)
                    {
                        itemList.Append(",");
#if DEBUG
                        itemList.AppendLine("\t\t\t");
#endif
                    }

                    // get the item script
                    IList<ScriptDescriptor> descriptors = keys[i].GetScriptDescriptors();

                    // get the items's list of script dependencies
                    List<ScriptReference> references = keys[i].GetScriptReferences();

                    // make sure the script dependencies are registered
                    _references.AddRange(references);

                    // write the item's config to the list
                    itemList.Append(((ExtScriptControlDescriptor)descriptors[0]).WriteScript(ScriptType.ConfigOnly));
                }

                itemList.Append("]");

                desc.AddPropertyBase("keys", itemList);
            }

            //// applyTo
            //if (!String.IsNullOrEmpty(applyTo))
            //{
            //    if (String.Compare(applyTo, ID, true) == 0)
            //        desc.AddPropertyBase("applyTo", String.Format("'{0}'", ClientID));
            //    else
            //        desc.AddPropertyBase("applyTo", String.Format("'{0}'", GetControlID(applyTo)));
            //}

            // contentEl
            if (!String.IsNullOrEmpty(contentEl))
                desc.AddPropertyBase("contentEl", String.Format("'{0}'", contentEl));               
            else if (html != null)
                desc.AddPropertyBase("contentEl", String.Format("'{0}'", contentEl));

            //if (!String.IsNullOrEmpty(targetID))
            //{
            //    if (String.Compare(targetID, GetControlID(targetID), true) == 0)
            //        desc.AddPropertyBase("targetID", String.Format("Ext.getCmp('{0}')", targetID));
            //    else
            //        desc.AddPropertyBase("targetID", String.Format("{0}", GetControlID(targetID)));
            //}

            if (!String.IsNullOrEmpty(arrowHandler))
                desc.AddPropertyBase("arrowHandler", String.Format("'{0}'", arrowHandler));

            if (!String.IsNullOrEmpty(arrowTooltip))
                desc.AddPropertyBase("arrowTooltip", String.Format("'{0}'", arrowTooltip));

            if (!String.IsNullOrEmpty(width))
                desc.AddPropertyBase("width", String.Format("{0}", width));

            if (!String.IsNullOrEmpty(height))
                desc.AddPropertyBase("height", String.Format("{0}", height));

            return list;
        }

        #region Public Properties

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public virtual List<ExtItem> buttons
        {
            get
            {
                return _buttons;
            }
        }

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public virtual List<ExtItem> keys
        {
            get
            {
                return _keys;
            }
        }

        public Boolean? allowDepress
        {
            get;
            set;
        }

        public String clickEvent { get; set; }

        public Boolean? enableToggle { get; set; }

        public Boolean? handleMouseEvents { get; set; }

        public Boolean? hidden { get; set; }


        public String menuAlign { get; set; }


        public Boolean? pressed { get; set; }

        public Boolean? repeat { get; set; }

        public String template { get; set; }

        public String toggleGroup { get; set; }

        public String toggleHandler { get; set; }

        public String tooltip { get; set; }

        public String tooltipType { get; set; }

        public String type { get; set; }

        #endregion

        #region Public Properties
      
        /// <summary>
        /// The CSS class to use when the control is checked (defaults to 'x-form-check-checked'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.
        /// </summary>
        [DefaultValue("x-form-check-checked")]
        [Description("The CSS class to use when the control is checked (defaults to 'x-form-check-checked'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.")]
        public String checkedCls { get; set; }

        /// <summary>
        /// The CSS class to use when the control receives input focus (defaults to 'x-form-check-focus'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.
        /// </summary>
        [DefaultValue("x-form-check-focus")]
        [Description("The CSS class to use when the control receives input focus (defaults to 'x-form-check-focus'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.")]
        public String focusCls { get; set; }

        /// <summary>
        /// The value that should go into the generated input element's value attribute (defaults to undefined, with no value attribute)
        /// </summary>
        [Description("The value that should go into the generated input element's value attribute (defaults to undefined, with no value attribute)")]
        public String inputValue { get; set; }

        /// <summary>
        /// The CSS class to use when the control is being actively clicked (defaults to 'x-form-check-down'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.
        /// </summary>
        [DefaultValue("x-form-check-down")]
        [Description("The CSS class to use when the control is being actively clicked (defaults to 'x-form-check-down'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.")]
        public String mouseDownCls { get; set; }

        /// <summary>
        /// An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element, and removed when the mouse moves out. (defaults to ''). This can be useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.
        /// </summary>
        [DefaultValue("x-form-check-over")]
        [Description("The CSS class to use when the control is hovered over (defaults to 'x-form-check-over'). Note that this class applies to both checkboxes and radio buttons and is added to the control's wrapper element.")]
        public String overCls { get; set; }

        #endregion

        #region Public Properties

        public Boolean? allowReselect { get; set; }

        public String tpl { get; set; }

        public String colors { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// The text query to send to the server to return all records for the list with no filtering (defaults to '').
        /// </summary>
        [Category("Config Options")]
        [Description("The text query to send to the server to return all records for the list with no filtering (defaults to '').")]
        public String allQuery { get; set; }

        /// <summary>
        /// Set to 'local' if the ComboBox loads local data (defaults to 'remote' which loads from the server).
        /// </summary>
        [DefaultValue(DataLoadMode.Remote)]
        [Description("Set to 'local' if the ComboBox loads local data (defaults to 'remote' which loads from the server).")]
        public DataLoadMode? mode { get; set; }

        /// <summary>
        /// The underlying data field name to bind to this ComboBox (defaults to undefined if mode = 'remote' or 'text' if transforming a select).
        /// </summary>        
        [Category("Config Options")]
        [Description("The underlying data field name to bind to this ComboBox (defaults to undefined if mode = 'remote' or 'text' if transforming a select).")]
        public String displayField { get; set; }

        /// <summary>
        /// The action to execute when the trigger field is activated. Use 'All' to run the query specified by the allQuery config option (defaults to 'Query').
        /// </summary>
        [DefaultValue(TriggerAction.Query)]
        [Description("The action to execute when the trigger field is activated. Use 'All' to run the query specified by the allQuery config option (defaults to 'Query').")]
        public TriggerAction? triggerAction { get; set; }

        /// <summary>
        /// False to prevent the user from typing text directly into the field, just like a traditional select (defaults to true).
        /// </summary>
        [Category("Behavior")]
        [DefaultValue(true)]
        [Description("False to prevent the user from typing text directly into the field, just like a traditional select (defaults to true).")]
        public Boolean? editable { get; set; }

        /// <summary>
        /// True to restrict the selected value to one of the values in the list, false to allow the user to set arbitrary text into the field (defaults to false).
        /// </summary>
        [Category("Behavior")]
        [DefaultValue(false)]
        [Description("True to restrict the selected value to one of the values in the list, false to allow the user to set arbitrary text into the field (defaults to false).")]
        public Boolean? forceSelection { get; set; }

        /// <summary>
        /// The height in pixels of the dropdown list resize handle if resizable = true (defaults to 8).
        /// </summary>
        [Category("Config Options")]
        [DefaultValue("8")]
        [Description("The height in pixels of the dropdown list resize handle if resizable = true (defaults to 8).")]
        public Unit? handleHeight { get; set; }

        /// <summary>
        /// If specified, a hidden form field with this name is dynamically generated to store the field's data value (defaults to the underlying DOM element's name). Required for the combo's value to automatically post during a form submission.
        /// </summary>
        [Description("If specified, a hidden form field with this name is dynamically generated to store the field's data value (defaults to the underlying DOM element's name). Required for the combo's value to automatically post during a form submission.")]
        public String hiddenName { get; set; }

        /// <summary>
        /// True to prevent the ComboBox from rendering until requested (should always be used when rendering into an Ext.Editor, defaults to false).
        /// </summary>
        [Category("Behavior")]
        [DefaultValue(false)]
        [Description("True to prevent the ComboBox from rendering until requested (should always be used when rendering into an Ext.Editor, defaults to false).")]
        public Boolean? lazyRender { get; set; }

        /// <summary>
        /// A valid anchor position value. See Ext.Element.alignTo for details on supported anchor positions (defaults to 'tl-bl').
        /// </summary>
        [Category("Config Options")]
        [Description("A valid anchor position value. See Ext.Element.alignTo for details on supported anchor positions (defaults to 'tl-bl').")]
        public String listAlign { get; set; }

        /// <summary>
        /// CSS class to apply to the dropdown list element (defaults to '').
        /// </summary>
        [Category("Config Options")]
        [Description("CSS class to apply to the dropdown list element (defaults to '').")]
        public String listClass { get; set; }

        /// <summary>
        /// The width in pixels of the dropdown list (defaults to the width of the ComboBox field).
        /// </summary>
        [Category("Config Options")]
        [Description("The width in pixels of the dropdown list (defaults to the width of the ComboBox field).")]
        public Unit? listWidth { get; set; }

        /// <summary>
        /// The text to display in the dropdown list while data is loading. Only applies when mode = 'remote' (defaults to 'Loading...').
        /// </summary>
        [Category("Config Options")]
        [DefaultValue("Loading...")]
        [Localizable(true)]
        [Description("The text to display in the dropdown list while data is loading. Only applies when mode = 'remote' (defaults to 'Loading...').")]
        public String loadingText { get; set; }

        /// <summary>
        /// The maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300).
        /// </summary>        
        [Category("Config Options")]
        [DefaultValue("300")]
        [Description("The maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300).")]
        public Unit? maxHeight { get; set; }

        /// <summary>
        ///  The minimum height in pixels of the dropdown list when the list is constrained by its distance to the viewport edges (defaults to 90).
        /// </summary>  
        [Category("Config Options")]
        [DefaultValue("90")]
        [Description("The minimum height in pixels of the dropdown list when the list is constrained by its distance to the viewport edges (defaults to 90).")]
        public Unit? minHeight { get; set; }

        /// <summary>
        /// The minimum number of characters the user must type before autocomplete and typeahead activate (defaults to 4 if remote or 0 if local, does not apply if editable = false).
        /// </summary>
        [DefaultValue(4)]
        [Description("The minimum number of characters the user must type before autocomplete and typeahead activate (defaults to 4 if remote or 0 if local, does not apply if editable = false).")]
        public String minChars { get; set; }

        /// <summary>
        /// The minimum width of the dropdown list in pixels (defaults to 70, will be ignored if listWidth has a higher value).
        /// </summary>
        [DefaultValue(typeof(Unit), "70")]
        [Description("The minimum width of the dropdown list in pixels (defaults to 70, will be ignored if listWidth has a higher value).")]
        public String minListWidth { get; set; }

        public String boxLabel { get; set; }

        /// <summary>
        /// If greater than 0, a paging toolbar is displayed in the footer of the dropdown list and the filter queries will execute with page addToStart and limit parameters. Only applies when mode = 'remote' (defaults to 0).
        /// </summary>
        [DefaultValue(0)]
        [Description("If greater than 0, a paging toolbar is displayed in the footer of the dropdown list and the filter queries will execute with page addToStart and limit parameters. Only applies when mode = 'remote' (defaults to 0).")]
        public int? pageSize { get; set; }

        /// <summary>
        /// The length of time in milliseconds to delay between the addToStart of typing and sending the query to filter the dropdown list (defaults to 500 if mode = 'remote' or 10 if mode = 'local').
        /// </summary>
        [DefaultValue(500)]
        [Description("The length of time in milliseconds to delay between the addToStart of typing and sending the query to filter the dropdown list (defaults to 500 if mode = 'remote' or 10 if mode = 'local').")]
        public String queryDelay { get; set; }

        /// <summary>
        /// Name of the query as it will be passed on the querystring (defaults to 'query').
        /// </summary>
        [DefaultValue("query")]
        [Description("Name of the query as it will be passed on the querystring (defaults to 'query').")]
        public String queryParam { get; set; }

        [DefaultValue(false)]
        [Description("True to add a resize handle to the bottom of the dropdown list (defaults to false)")]
        public Boolean? resizable { get; set; }

        /// <summary>
        /// CSS class to apply to the selected items in the dropdown list (defaults to 'x-combo-selected').
        /// </summary>
        [Description("CSS class to apply to the selected items in the dropdown list (defaults to 'x-combo-selected').")]
        public String selectedClass { get; set; }

        [DefaultValue(true)]
        public Boolean? enableShadow { get; set; }     

        /// <summary>
        /// The ID of an existing select to convert to a ComboBox.
        /// </summary>
        [Description("The ID of an existing select to convert to a ComboBox.")]
        public String transform { get; set; }


        /// <summary>
        /// True to populate and autoselect the remainder of the text being typed after a configurable delay (typeAheadDelay) if it matches a known value (defaults to false).
        /// </summary>
        [Description("True to populate and autoselect the remainder of the text being typed after a configurable delay (typeAheadDelay) if it matches a known value (defaults to false).")]
        public Boolean? typeAhead { get; set; }

        /// <summary>
        /// The length of time in milliseconds to wait until the typeahead text is displayed if TypeAhead = true (defaults to 250).
        /// </summary>
        [DefaultValue(250)]
        [Description("The length of time in milliseconds to wait until the typeahead text is displayed if TypeAhead = true (defaults to 250).")]
        public String typeAheadDelay { get; set; }

        /// <summary>
        /// The underlying data value name to bind to this ComboBox (defaults to undefined if mode = 'remote' or 'value' if transforming a select) Note: use of a valueField requires the user to make a selection in order for a value to be mapped.
        /// </summary>
        [Description("The underlying data value name to bind to this ComboBox (defaults to undefined if mode = 'remote' or 'value' if transforming a select) Note: use of a valueField requires the user to make a selection in order for a value to be mapped.")]
        public String valueField { get; set; }

        /// <summary>
        /// When using a name/value combo, if the value passed to setValue is not found in the store, valueNotFoundText will be displayed as the field text if defined (defaults to undefined).
        /// </summary>
        [Description("When using a name/value combo, if the value passed to setValue is not found in the store, valueNotFoundText will be displayed as the field text if defined (defaults to undefined).")]
        public String valueNotFoundText { get; set; }

        /// <summary>
        /// The data store to use.
        /// </summary>
        [Description("The data store to use.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtContainer))]
        [TemplateInstance(TemplateInstance.Single)]
        public ExtStore store { get; set; }

        /// <summary>
        /// The data store to use.
        /// </summary>
        [Description("The data store to use.")]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtContainer))]
        [TemplateInstance(TemplateInstance.Single)]
        public ExtSimpleStore simpleStore { get; set; }

        public String cancelText { get; set; }

        public Boolean? constrainToViewport { get; set; }

        public String dayNames { get; set; }

        public String anchor { get; set; }

        public String disabledDatesRE { get; set; }

        public String disabledDatesText { get; set; }

        public String disabledDays { get; set; }

        public String disabledDaysText { get; set; }

        public String format { get; set; }

        public DateTime? maxDate { get; set; }

        public DateTime? minDate { get; set; }

        public String monthNames { get; set; }

        public String monthYearText { get; set; }

        public String nextText { get; set; }

        public String okText { get; set; }

        public String prevText { get; set; }

        public Int32? startDay { get; set; }

        public String todayText { get; set; }

        public String todayTip { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// True to render a checkbox into the fieldset frame just in front of the legend (defaults to false). The fieldset will be expanded or collapsed when the checkbox is toggled.
        /// </summary>
        [Description("True to render a checkbox into the fieldset frame just in front of the legend (defaults to false). The fieldset will be expanded or collapsed when the checkbox is toggled.")]
        public String checkboxName { get; set; }

        /// <summary>
        /// True to render a checkbox into the fieldset frame just in front of the legend (defaults to false). The fieldset will be expanded or collapsed when the checkbox is toggled.
        /// </summary>
        [Description("True to render a checkbox into the fieldset frame just in front of the legend (defaults to false). The fieldset will be expanded or collapsed when the checkbox is toggled.")]
        public String checkboxToggle { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// False to disallow decimal values (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("False to disallow decimal values (defaults to true).")]
        public Boolean? allowDecimals { get; set; }

        /// <summary>
        /// False to prevent entering a negative sign (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("False to prevent entering a negative sign (defaults to true).")]
        public Boolean? allowNegative { get; set; }

        /// <summary>
        /// The base set of characters to evaluate as valid numbers (defaults to '0123456789').
        /// </summary>
        [DefaultValue("0123456789")]
        [Description("The base set of characters to evaluate as valid numbers (defaults to '0123456789').")]
        public String baseChars { get; set; }

        /// <summary>
        /// The maximum precision to display after the decimal separator (defaults to 2).
        /// </summary>
        [DefaultValue(2)]
        [Description("The maximum precision to display after the decimal separator (defaults to 2).")]
        public int? decimalPrecision { get; set; }

        /// <summary>
        /// Character(s) to allow as the decimal separator (defaults to '.').
        /// </summary>
        [DefaultValue(".")]
        [Description("Character(s) to allow as the decimal separator (defaults to '.').")]
        public String decimalSeparator { get; set; }

        /// <summary>
        /// Error text to display if the maximum value validation fails (defaults to 'The maximum value for this field is {maxValue}').
        /// </summary>
        [DefaultValue("The maximum value for this field is {maxValue}")]
        [Description("Error text to display if the maximum value validation fails (defaults to 'The maximum value for this field is {maxValue}').")]
        public String maxText { get; set; }

        /// <summary>
        /// The maximum allowed value (defaults to Double.MaxValue)
        /// </summary>
        [DefaultValue(Double.MaxValue)]
        [Description("The maximum allowed value (defaults to Double.MaxValue)")]
        public Double? maxValue { get; set; }

        /// <summary>
        /// Error text to display if the minimum value validation fails (defaults to 'The minimum value for this field is {minValue}').
        /// </summary>
        [DefaultValue("The minimum value for this field is {minValue}")]
        [Description("Error text to display if the minimum value validation fails (defaults to 'The minimum value for this field is {minValue}').")]
        public Unit? minText { get; set; }

        /// <summary>
        /// The minimum allowed value (defaults to Double.MinValue)
        /// </summary>
        [DefaultValue(Double.MinValue)]
        [Description("The minimum allowed value (defaults to Double.MinValue)")]
        public Double? minValue { get; set; }

        /// <summary>
        /// Error text to display if the value is not a valid number. For example, this can happen if a valid character like '.' or '-' is left in the field with no number (defaults to '{value} is not a valid number').
        /// </summary>
        [DefaultValue("{value} is not a valid number")]
        [Description("Error text to display if the value is not a valid number. For example, this can happen if a valid character like '.' or '-' is left in the field with no number (defaults to '{value} is not a valid number').")]
        public String nanText { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// The default text for the create link prompt.
        /// </summary>
        [Localizable(true)]
        [Description("The default text for the create link prompt.")]
        public String createLinkText { get; set; }

        /// <summary>
        /// The default value for the create link prompt (defaults to http://).
        /// </summary>
        [DefaultValue("http://")]
        [Description("The default value for the create link prompt (defaults to http://).")]
        public String defaultLinkValue { get; set; }

        /// <summary>
        /// Enable the left, center, right alignment buttons (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the left, center, right alignment buttons (defaults to true).")]
        public Boolean? enableAlignments { get; set; }

        /// <summary>
        /// Enable the fore/highlight color buttons (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the fore/highlight color buttons (defaults to true).")]
        public Boolean? enableColors { get; set; }

        /// <summary>
        /// Enable font selection. Not available in Safari. (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable font selection. Not available in Safari. (defaults to true).")]
        public Boolean? enableFont { get; set; }

        /// <summary>
        /// Enable the increase/decrease font size buttons (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the increase/decrease font size buttons (defaults to true).")]
        public Boolean? enableFontSize { get; set; }

        /// <summary>
        /// Enable the bold, italic and underline buttons (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the bold, italic and underline buttons (defaults to true).")]
        public Boolean? enableFormat { get; set; }

        /// <summary>
        /// Enable the create link button. Not available in Safari. (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the create link button. Not available in Safari. (defaults to true).")]
        public Boolean? enableLinks { get; set; }

        /// <summary>
        /// Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true).")]
        public Boolean? enableLists { get; set; }

        /// <summary>
        /// Enable the switch to source edit button. Not available in Safari. (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Enable the switch to source edit button. Not available in Safari. (defaults to true).")]
        public Boolean? enableSourceEdit { get; set; }

        /// <summary>
        /// An array of available font families.
        /// </summary>        
        [DefaultValue(null)]
        [Description("An array of available font families.")]
        public String fontFamilies { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// The field's HTML name attribute.
        /// </summary>
        [Description("The field's HTML name attribute.")]
        public String groupName { get; set; }

        #endregion

        #region PublicProperties

        public String arrowHandler { get; set; }

        public String arrowTooltip { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// False to validate that the value length > 0 (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("False to validate that the value length > 0 (defaults to true).")]
        public Boolean? allowBlank { get; set; }

        /// <summary>
        /// Error text to display if the allow blank validation fails (defaults to 'This field is required').
        /// </summary>
        [Description("Error text to display if the allow blank validation fails (defaults to 'This field is required').")]
        public String blankText { get; set; }

        /// <summary>
        /// True to disable input keystroke filtering (defaults to false).
        /// </summary>
        [Description("True to disable input keystroke filtering (defaults to false).")]
        public Boolean? disableKeyFilter { get; set; }

        /// <summary>
        /// The CSS class to apply to an empty field to style the emptyText (defaults to 'x-form-empty-field'). This class is automatically added and removed as needed depending on the current field value.
        /// </summary>
        [Description("The CSS class to apply to an empty field to style the emptyText (defaults to 'x-form-empty-field'). This class is automatically added and removed as needed depending on the current field value.")]
        public String emptyClass { get; set; }

        /// <summary>
        /// The default text to display in an empty field (defaults to null).
        /// </summary>
        [Description("The default text to display in an empty field (defaults to null).")]
        public String emptyText { get; set; }

        /// <summary>
        /// True to enable the proxying of key events for the HTML input field (defaults to false)
        /// </summary>
        [Description("True to enable the proxying of key events for the HTML input field (defaults to false)")]
        public Boolean? enableKeyEvents { get; set; }

        /// <summary>
        /// True if this field should automatically grow and shrink to its content (defaults to false).
        /// </summary>
        [Description("True if this field should automatically grow and shrink to its content (defaults to false).")]
        public String grow { get; set; }

        public String key { get; set; }

        public Boolean? ctrl { get; set; }

        public Boolean? shift { get; set; }

        public Boolean? stopEvent { get; set; }

        /// <summary>
        /// The maximum width to allow when grow = true (defaults to 800).
        /// </summary>
        [DefaultValue(typeof(Unit), "800")]
        [Description("The maximum width to allow when grow = true (defaults to 800).")]
        public Unit? growMax { get; set; }

        /// <summary>
        /// The minimum width to allow when grow = true (defaults to 30).
        /// </summary>
        [DefaultValue(typeof(Unit), "30")]
        [Description("The minimum width to allow when grow = true (defaults to 30).")]
        public Unit? growMin { get; set; }

        /// <summary>
        /// An input mask regular expression that will be used to filter keystrokes that don't match (defaults to null).
        /// </summary>
        [Description("An input mask regular expression that will be used to filter keystrokes that don't match (defaults to null).")]
        public String maskRe { get; set; }

        /// <summary>
        /// The type attribute for input fields.
        /// </summary>        
        [DefaultValue(InputType.Text)]
        [Description("The type attribute for input fields.")]
        public InputType? inputType { get; set; }

        /// <summary>
        /// Maximum input field length allowed (defaults to Number.MAX_VALUE).
        /// </summary>
        [Description("Maximum input field length allowed (defaults to Number.MAX_VALUE).")]
        public int? maxLength { get; set; }

        /// <summary>
        /// Error text to display if the maximum length validation fails (defaults to 'The maximum length for this field is {maxLength}').
        /// </summary>
        [Description("Error text to display if the maximum length validation fails (defaults to 'The maximum length for this field is {maxLength}').")]
        public String maxLengthText { get; set; }

        /// <summary>
        /// A JavaScript RegExp object to be tested against the field value during validation (defaults to null). If available, this regex will be evaluated only after the basic validators all return true, and will be passed the current field value. If the test fails, the field will be marked invalid using RegexText.
        /// </summary>
        [Description("A JavaScript RegExp object to be tested against the field value during validation (defaults to null). If available, this regex will be evaluated only after the basic validators all return true, and will be passed the current field value. If the test fails, the field will be marked invalid using RegexText.")]
        public String regex { get; set; }

        /// <summary>
        /// The error text to display if regex is used and the test fails during validation (defaults to '').
        /// </summary>
        [Description("The error text to display if regex is used and the test fails during validation (defaults to '').")]
        public String regexText { get; set; }

        /// <summary>
        /// True to automatically select any existing field text when the field receives input focus (defaults to false).
        /// </summary>
        [Description("True to automatically select any existing field text when the field receives input focus (defaults to false).")]
        public Boolean? selectOnFocus { get; set; }

        /// <summary>
        /// If MaxLength property has been set, more characters than the MaxLength can be entered if Truncate='false'. If 'false', then a validation error is rendered if more characters entered (or pasted) than the MaxLength property. Default value is 'true'.
        /// </summary>
        [DefaultValue(true)]
        [Description("If MaxLength property has been set, more characters than the MaxLength can be entered if Truncate='false'. If 'false', then a validation error is rendered if more characters entered (or pasted) than the MaxLength property. Default value is 'true'.")]
        public Boolean? truncate { get; set; }

        ///// <summary>
        ///// A custom validation function to be called during field validation (defaults to null). If available, this function will be called only after the basic validators all return true, and will be passed the current field value and expected to return boolean true if the value is valid or a string error message if invalid.
        ///// </summary>
        //[Description("A custom validation function to be called during field validation (defaults to null). If available, this function will be called only after the basic validators all return true, and will be passed the current field value and expected to return boolean true if the value is valid or a string error message if invalid.")]
        //public String validator { get; set; }

        /// <summary>
        /// A validation type name as defined in Ext.form.VTypes (defaults to null).
        /// </summary>
        [Description("A validation type name as defined in Ext.form.VTypes (defaults to null).")]
        public String vtype { get; set; }

        /// <summary>
        /// A custom error message to display in place of the default message provided for the vtype currently set for this field (defaults to ''). Only applies if vtype is set, else ignored.
        /// </summary>
        [Description("A custom error message to display in place of the default message provided for the vtype currently set for this field (defaults to ''). Only applies if vtype is set, else ignored.")]
        public String vtypeText { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// A DomHelper element spec (defaults to {tag: 'input', type: 'text', size: '20', autocomplete: 'off'}).
        /// </summary>
        [Browsable(false)]
        [Description("A DomHelper element spec (defaults to {tag: 'input', type: 'text', size: '20', autocomplete: 'off'}).")]
        public String autoCreate { get; set; }

        /// <summary>
        /// The CSS class used to provide field clearing (defaults to 'x-form-clear-left').
        /// </summary>
        [Description("The CSS class used to provide field clearing (defaults to 'x-form-clear-left').")]
        public String clearCls { get; set; }

        /// <summary>
        /// The default CSS class for the field (defaults to 'x-form-field').
        /// </summary>
        [Description("The default CSS class for the field (defaults to 'x-form-field').")]
        public String fieldClass { get; set; }

        /// <summary>
        /// The label text to display next to this field (defaults to '').
        /// </summary>
        [Description("The label text to display next to this field (defaults to '').")]
        public String fieldLabel { get; set; }

        /// <summary>
        /// The CSS class to use when the field receives focus (defaults to 'x-form-focus').
        /// </summary>
        [Description("The CSS class to use when the field receives focus (defaults to 'x-form-focus').")]
        public String focusClass { get; set; }

        /// <summary>
        /// True to completely hide the label element (defaults to false).
        /// </summary>
        [Description("True to completely hide the label element (defaults to false).")]
        public Boolean? hideLabel { get; set; }

        /// <summary>
        /// The CSS class to use when marking a field invalid (defaults to 'x-form-invalid').
        /// </summary>
        [Description("The CSS class to use when marking a field invalid (defaults to 'x-form-invalid').")]
        public String invalidClass { get; set; }

        /// <summary>
        /// The error text to use when marking a field invalid and no message is provided (defaults to 'The value in this field is invalid').
        /// </summary>
        [Description("The error text to use when marking a field invalid and no message is provided (defaults to 'The value in this field is invalid').")]
        public String invalidText { get; set; }


        /// <summary>
        /// The standard separator to display after the text of each form label (defaults is a colon ':'). To display no separator for this field's label specify empty string ''.
        /// </summary>
        [DefaultValue(":")]
        [Description("The standard separator to display after the text of each form label (defaults is a colon ':'). To display no separator for this field's label specify empty string ''.")]
        public String labelSeparator { get; set; }

        /// <summary>
        /// A CSS style specification to apply directly to this field's label (defaults to the contentContainer's labelStyle value if set, or ''). For example, labelStyle: 'font-weight:bold;'.
        /// </summary>
        [Description("A CSS style specification to apply directly to this field's label (defaults to the contentContainer's labelStyle value if set, or ''). For example, labelStyle: 'font-weight:bold;'.")]
        public String labelStyle { get; set; }

        /// <summary>
        /// EXPERIMENTAL The effect used when displaying a validation message under the field (defaults to 'normal').
        /// </summary>
        [DefaultValue("normal")]
        [Description("EXPERIMENTAL The effect used when displaying a validation message under the field (defaults to 'normal').")]
        public String msgFx { get; set; }

        /// <summary>
        /// True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.
        /// </summary>
        [Description("True to mark the field as readOnly in HTML (defaults to false) -- Note: this only sets the element's readOnly DOM attribute.")]
        public Boolean? readOnly { get; set; }

        /// <summary>
        /// The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).
        /// </summary>
        [DefaultValue((short)0)]
        [Description("The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).")]
        public short? tabIndex { get; set; }

        /// <summary>
        /// Whether the field should validate when it loses focus (defaults to true).
        /// </summary>
        [DefaultValue(true)]
        [Description("Whether the field should validate when it loses focus (defaults to true).")]
        public Boolean? validateOnBlur { get; set; }

        /// <summary>
        /// The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).
        /// </summary>
        [DefaultValue(250)]
        [Description("The length of time in milliseconds after user input begins until validation is initiated (defaults to 250).")]
        public int? validateDelay { get; set; }

        /// <summary>
        /// The event that should initiate field validation. Set to false to disable automatic validation (defaults to 'keyup').
        /// </summary>
        [Description("The event that should initiate field validation. Set to false to disable automatic validation (defaults to 'keyup').")]
        public String validationEvent { get; set; }

        /// <summary>
        /// The Text value to initialize this field with.
        /// </summary>
        [DefaultValue("")]
        [Description("The Text value to initialize this field with.")]
        public String value { get; set; }


        #endregion

        #region public properties
      
        public String itemCls { get; set; }

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public ExtMenu menu { get; set; }

        public Int32? showDelay { get; set; }

        public Boolean? allowOtherMenus { get; set; }

        public String defaultAlign { get; set; }      

        public Int32? minWidth { get; set; }

        public shadow? shadow { get; set; }

        public String subMenuAlign { get; set; }

        public String activeClass { get; set; }

        public Boolean? canActivate { get; set; }

        public Int32? hideDelay { get; set; }

        public Boolean? hideOnClick { get; set; }

        public String scope { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// The content to be added to the Container
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtContainer))]
        [TemplateInstance(TemplateInstance.Single)]
        [Description("The childrens of the tree.")]
        public List<ExtTreeNode> children { get; set; }

        /// <summary>
        /// Identifier value.
        /// </summary>
        [Description("Identifier value.")]
        public override String id { get; set; }

        [DefaultValue(false)]
        [Description("True if this node is a leaf and does not have children")]
        public Boolean? leaf { get; set; }

        [DefaultValue(true)]
        [Description("False to not allow this node to have child nodes (defaults to true)")]
        public Boolean? allowChildren { get; set; }

        [DefaultValue(true)]
        [Description("False to make this node undraggable if draggable = true (defaults to true)")]
        public Boolean? allowDrag { get; set; }

        [DefaultValue(true)]
        [Description("False if this node cannot have child nodes dropped on it (defaults to true)")]
        public Boolean? allowDrop { get; set; }

        [DefaultValue("")]
        [Description("A css class to be added to the node.")]
        public String cls { get; set; }

        [DefaultValue(false)]
        [Description("True to start the node disabled")]
        public Boolean? disabled { get; set; }

        [DefaultValue(false)]
        [Description("True to make this node draggable (defaults to false)")]
        public Boolean? draggable { get; set; }

        [DefaultValue(false)]
        [Description("True to make this node closable (defaults to false)")]
        public Boolean? closable { get; set; }

        public Boolean? constrain { get; set; }

        [DefaultValue(false)]
        [Description("True to start the node expanded")]
        public Boolean? expanded { get; set; }

        [DefaultValue("#")]
        [Description("URL of the link used for the node (defaults to #)")]
        public String href { get; set; }

        [DefaultValue("")]
        [Description("Target frame for the link")]
        public String hrefTarget { get; set; }

        [DefaultValue("")]
        [Description("The path to an icon for the node. The preferred way to do this is to use the cls or iconCls attributes and add the icon via a CSS background image.")]
        public String iconFile { get; set; }

        [DefaultValue("")]
        [Description("The icon to use for the Node. See also, IconCls to set an icon with a custom Css class.")]
        public String icon { get; set; }

        [DefaultValue("")]
        [Description("A css class to be added to the nodes icon element for applying css background images")]
        public String iconCls { get; set; }

        [DefaultValue(true)]
        [Description("False to not allow this node to act as a drop target (defaults to true)")]
        public Boolean? isTarget { get; set; }

        [DefaultValue("")]
        [Description("An Ext QuickTip for the node")]
        public String qtip { get; set; }

        [DefaultValue(false)]
        [Description("True for single click expand on this node")]
        public Boolean? singleClickExpand { get; set; }

        [DefaultValue("")]
        [Description("The text for this node")]
        public String text { get; set; }

        [DefaultValue("")]
        [Description("True to render a checked checkbox for this node, false to render an unchecked checkbox (defaults to undefined with no..")]
        public Boolean? Checked { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// The root node for the tree.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtTreeNode))]
        [TemplateInstance(TemplateInstance.Single)]
        [Description("The root node for the tree.")]
        public List<ExtTreeNode> root { get; set; }

        /// <summary>
        /// The loader for the tree.
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtTreeLoader))]
        [TemplateInstance(TemplateInstance.Single)]
        [Description("The loader for the tree.")]
        public List<ExtTreeLoader> loader { get; set; }

        public Boolean? autoScroll { get; set; }

        public Boolean? border { get; set; }

        [DefaultValue(true)]
        [Description("true to enable animated expand/collapse (defaults to the value of Ext.enableFx)")]
        public Boolean? animate { get; set; }

        [Description("True to register this container with ScrollManager")]
        public Boolean? containerScroll { get; set; }

        [Description("True if the tree should only allow append drops (use for trees which are sorted)")]
        public Boolean? ddAppendOnly { get; set; }

        [DefaultValue("")]
        [Description("The DD group this TreePanel belongs to")]
        public Boolean? ddGroup { get; set; }

        [Description("True to enable body scrolling")]
        public Boolean? ddScroll { get; set; }

        [Description("True to enable drag and drop")]
        public Boolean? enableDD { get; set; }

        [Description("True to enable just drag")]
        public Boolean? enableDrag { get; set; }

        [Description("True to enable just drop")]
        public Boolean? enableDrop { get; set; }

        [DefaultValue("C3DAF9")]
        [Description("The color of the node highlight (defaults to C3DAF9)")]
        public String highlightColor { get; set; }

        [DefaultValue(true)]
        [Description("False to disable node highlight on drop (defaults to the value of Ext.enableFx)")]
        public Boolean? highlightDrop { get; set; }

        [DefaultValue(true)]
        [Description("False to disable tree lines (defaults to true)")]
        public Boolean? lines { get; set; }

        [DefaultValue("/")]
        [Description("The token used to separate sub-paths in path strings (defaults to '/')")]
        public String pathSeparator { get; set; }

        [DefaultValue(true)]
        [Description("false to hide the root node (defaults to true)")]
        public Boolean? rootVisible { get; set; }

        [Description("true if only 1 node per branch may be expanded")]
        public Boolean? singleExpand { get; set; }

        [DefaultValue(true)]
        [Description("False to disable mouse over highlighting")]
        public Boolean? trackMouseOver { get; set; }

        [Description("True to use Vista-style arrows in the tree (defaults to false)")]
        public Boolean? useArrows { get; set; }

        #endregion

        #region Public Properties

        /// <summary>
        /// tree ID to sort
        /// </summary>
        [Description("tree panel ID to sort.")]
        public String targetID { get; set; }

        /// <summary>
        /// true for case sensitive sort (defaults to false)
        /// </summary>
        [Description("true for case sensitive sort (defaults to false)")]
        public Boolean? caseSensitive { get; set; }

        /// <summary>
        /// The direction to sort (asc or desc) (defaults to asc)
        /// </summary>
        [Description("The direction to sort (asc or desc) (defaults to asc)")]
        public String dir { get; set; }

        /// <summary>
        /// True to sort leaf nodes under non leaf nodes
        /// </summary>
        [Description("True to sort leaf nodes under non leaf nodes")]
        public Boolean? folderSort { get; set; }

        /// <summary>
        /// The attribute used to determine leaf nodes in folder sort (defaults to "leaf")
        /// </summary>
        [Description("The attribute used to determine leaf nodes in folder sort (defaults to leaf)")]
        public String leafAttr { get; set; }

        /// <summary>
        /// The named attribute on the node to sort by (defaults to text)
        /// </summary>
        [Description("The named attribute on the node to sort by (defaults to text)")]
        public String property { get; set; }

        /// <summary>
        /// A custom "casting" function used to convert node values before sorting
        /// </summary>
        [Description("A custom casting function used to convert node values before sorting")]
        public String sortType { get; set; }

        /// <summary>
        /// Specify the alignment of labels of the form elements.
        /// </summary>
        public String labelAlign { get; set; }


        /// <summary>
        /// Specify the width of each label.
        /// </summary>
        public String labelWidth { get; set; }

        /// <summary>
        /// True to make the window modal and mask everything behind it when displayed, 
        /// false to display it without restricting access to other UI elements (defaults to false).
        /// </summary>
        public Boolean? modal { get; set; } 

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public List<ConfigItem> tbar
        {
            get
            {
                return _tbar;
            }
        }

        /// <summary>
        /// Minimun size of the region
        /// </summary>
        public int? minTabWidth { get; set; }

        /// <summary>
        /// Maximun size of the region
        /// </summary>
        public int? tabWidth { get; set; }

        public String activeTab { get; set; }

        public Boolean? deferredRender { get; set; }

        public Boolean? resizeTabs { get; set; }

        public Boolean? enableTabScroll { get; set; }


        /// <summary>
        /// The content to be added to the Container
        /// </summary>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [TemplateContainer(typeof(ExtContainer))]
        [TemplateInstance(TemplateInstance.Single)]
        public ITemplate html { get; set; }

        /// <summary>
        /// A string component id or the numeric index of the component that should be 
        /// initially activated within the container's layout on render. For example, 
        /// activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the 
        /// container's collection). activeItem only applies to layout styles that 
        /// can display items one at a time (like Ext.layout.Accordion, 
        /// Ext.layout.CardLayout and Ext.layout.FitLayout). Related to 
        /// Ext.layout.ContainerLayout.activeItem. 
        /// </summary>
        public Object activeItem
        {
            get
            {
                return _activeItem;
            }
            set
            {
                switch (value.GetType().Name)
                {
                    case "String":
                        Int32 integer;
                        if (Int32.TryParse((String)value, out integer))
                            _activeItem = integer;
                        else if (((String)value).StartsWith("item-"))
                            _activeItem = value;
                        else
                            throw new Exception("activeItem string values must be in the format 'item-1'");
                        break;
                    case "Int16":
                    case "Int32":
                    case "Int64":
                        if (Convert.ToInt64(value) < 0)
                            throw new ArgumentException("Integer values for activeItem must be greater than or equal to 0");

                        _activeItem = value;
                        break;
                    default:
                        throw new ArgumentException("activeItem must be either an integer value or a string in the format 'item-1'");
                }
            }
        }


        /// <summary>
        /// The id (ClientId) of the node, a DOM node or an existing Element corresponding to a DIV
        /// </summary>
        public String applyTo { get; set; }

        public String contentEl { get; set; }


        public Boolean? autoDestroy { get; set; }

        public Boolean? bufferResize { get; set; }

        public xtype? defaultType { get; set; }

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public List<ConfigItem> defaults
        {
            get
            {
                return _defaults;
            }
        }

        [NotifyParentProperty(true)]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public virtual List<ExtItem> items
        {
            get
            {
                return _items;
            }
        }


        public Boolean? hideBorders { get; set; }

        public String layout { get; set; }

        public String layoutConfig { get; set; }

        public Boolean? monitorResize { get; set; }

        /// <summary>
        /// If the region is splited
        /// </summary>
        public bool? split { get; set; }

        public String margins { get; set; }

        public String cmargins { get; set; }

        public region? region { get; set; }

        public String name { get; set; }

        public Boolean? animCollapse { get; set; }       

        public String autoLoad { get; set; }

        public String baseCls { get; set; }

        public String bbar { get; set; }

        public Boolean? bodyBorder { get; set; }

        public String bodyStyle { get; set; }

        public Int32? bufferResizeMilliseconds { get; set; }

        public align? buttonAlign { get; set; }

        public Boolean? collapseFirst { get; set; }

        public Boolean? collapsed { get; set; }

        public String collapsedCls { get; set; }

        public Boolean? collapsible { get; set; }        

        public String elements { get; set; }

        public Boolean? floating { get; set; }

        public Boolean? footer { get; set; }

        public Boolean? frame { get; set; }

        public Boolean? header { get; set; }

        public Boolean? headerAsText { get; set; }

        public Boolean? hideCollapseTool { get; set; }

        public Boolean? maskDisabled { get; set; }

        public Int32? minButtonWidth { get; set; }

        //public String shadow
        //{
        //    get
        //    {
        //        return _shadow;
        //    }
        //    set
        //    {
        //        Boolean boolValue;
        //        if (!String.IsNullOrEmpty(value) && !Boolean.TryParse(value, out boolValue))
        //        {
        //            try
        //            {
        //                Enum.Parse(typeof(shadowMode), value, true);
        //            }
        //            catch (ArgumentException)
        //            {
        //                throw;
        //            }
        //        }
        //    }
        //}

        public Int32? shadowOffset { get; set; }

        public Boolean? shim { get; set; }

        public String tabTip { get; set; }

        //public String tbar { get; set; }

        public String title { get; set; }

        public Boolean? titleCollapse { get; set; }

        public String tools { get; set; }

        //public override String id { get; set; }

        #endregion

    }
}
